import 'package:flutter/material.dart';
import '../tabs/home.dart';
import '../tabs/settings.dart';
import '../tabs/settings2.dart';
import '../tabs/GlassHover.dart';
import '../tabs/MyLEDApp.dart';
import '../tabs/flip_demo.dart';
import '../sliverforlistpage.dart';

//https://cloud.tencent.com/developer/article/2216570
class Tabs extends StatefulWidget {
  const Tabs({Key? key}) : super(key: key);

  @override
  State<Tabs> createState() => _TabsState();
}

class _TabsState extends State<Tabs> {
  int _currentIndex=0;
  final List<Widget> _pages=[
    const HomePage(),
    const SliverForGridViewPage(),
    //const SettingPage(),
    //const Settings2Page()
    //const GlassHover()
    //const MyLEDApp()
    const FlipDemo()
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("Flutter demo"),
      ),
      body: _pages[_currentIndex],
      bottomNavigationBar: BottomNavigationBar(
        currentIndex: _currentIndex,
        onTap: (index){
          setState(() {
            _currentIndex=index;
          });
        },
        items: const [
          BottomNavigationBarItem(
              icon: Icon(Icons.home),
              label: "首页",
            ),
          BottomNavigationBarItem(
            icon: Icon(Icons.people),
            label: "好友",
          ),
          /*BottomNavigationBarItem(
            icon: Icon(Icons.access_time),
            label: "实验",
          ),*/
          BottomNavigationBarItem(
            icon: Icon(Icons.settings),
            label: "设置",
          ),
        ],
      ),
    );
  }
}